<template>
  <div>
    <el-alert title="数据一共x条" type="info" show-icon :closable="false">
      <div slot="title">数据一共{{ choiceList.length }}条</div>
    </el-alert>
    <el-table :data="choiceList" style="width: 100%" max-height="250">
      <el-table-column prop="number" label="试题编号" width="150">
      </el-table-column>
      <el-table-column prop="subject" label="学科" width="80">
      </el-table-column>
      <el-table-column prop="catalog" label="目录" width="100">
      </el-table-column>
      <el-table-column prop="questionType" label="题型" width="80">
      </el-table-column>
      <el-table-column prop="question" label="题干" width="260">
        <template slot-scope="scope">
          <div v-html="scope.row.question"></div>
        </template>
      </el-table-column>
      <el-table-column prop="addDate" label="录入时间" width="200">
        <template slot-scope="scope">
          <div>{{ scope.row.addDate | parseTimeByString("{y}-{m}-{d} {h}:{i}:{s}") }}</div>
        </template>
      </el-table-column>
      <el-table-column prop="difficulty" label="难度" width="80">
      </el-table-column>
      <el-table-column prop="creator" label="录入人" width="120">
      </el-table-column>
      <el-table-column prop="chkState" label="审核状态" width="80">
      </el-table-column>
      <el-table-column prop="chkRemarks" label="审核意见" width="120">
      </el-table-column>
      <el-table-column prop="chkUser" label="审核人" width="120">
      </el-table-column>
      <el-table-column prop="publishState" label="发布状态" width="80">
      </el-table-column>
      <el-table-column fixed="right" label="操作" width="200">
        <template slot-scope="scope">
          <!-- <div>{{scope.row}}</div> -->
          <el-button
            @click="$emit('previewOn', scope.row)"
            type="text"
            size="small"
          >
            预览
          </el-button>
          <el-button
            type="text"
            size="small"
            :disabled="scope.row.chkState === '待审核' ? false : true"
            @click="$emit('stateOn', scope.row)"
          >
            审核
          </el-button>
          <el-button
            @click="$emit('Put', scope.row)"
            type="text"
            size="small"
            :disabled="scope.row.publishState === '上架' ? true : false"
          >
            修改
          </el-button>
          <el-button
            @click="$emit('shelf', scope.row)"
            type="text"
            size="small"
          >
            {{ scope.row.publishState === "上架" ? "下架" : "上架" }}
          </el-button>
          <el-button
            @click="$emit('del', scope.row)"
            type="text"
            size="small"
            :disabled="scope.row.publishState === '上架' ? true : false"
          >
            移除
          </el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  data() {
    return {};
  },
  props: {
    choiceList: {
      type: Array,
      required: true
    }
  },
  created() {},
  mounted() {},
  methods: {}
};
</script>

<style scoped lang="less"></style>
